package com.sl.service;

import com.sl.pojo.Role;
import com.sl.pojo.RoleRoute;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.sl.mapper.RoleMapper;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.*;


@Service
public class RoleService {
    @Resource
    private RoleMapper roleMapper;
    ////查询：主键  权限
    public Role findById(Integer id){
        Role role = roleMapper.selectByPrimaryKey(id);
        return role;
    }
    //查询：所有
    public List<Role> findAll(){
        List<Role> roleList = roleMapper.selectAll();
        return  roleList;
    }

    //增加
    public void add(Role role){
        roleMapper.insertSelective(role);
    }
    //修改
    public void update(Role role){
        roleMapper.updateByPrimaryKeySelective(role);
    }

    public void deleteById(Role role) {
        roleMapper.deleteByPrimaryKey(role);
    }
}
